<template>
	<view class="listcontent container">
		<view class="contelis">
			<view class="titles">
				添加分类
				<view class="backs" @click="backgs"> <返回</view>
			</view>
			<view class="addcate">
				<u-input v-model="cantrouy"  :border="border" />
				<u-button @click="addcate" style="margin-top: 30px;">确定</u-button>
			</view>
		</view>
		<u-modal v-model="show" @confirm="confirm" style="text-align: center; padding: 20px 0;" :show-cancel-button="true" >确定提交吗？</u-modal>
	</view>
</template>

<script>
	import api from '../../api/api.js';
	export default {
		data() {
			return {
				cantrouy:'',
				border: true,
				show:false,
			}
		},
		methods: {
			backgs(){
				
						uni.navigateTo({
							url:'/pages/index/index'
						})			
			},
			addcate(){
				if(!this.cantrouy){
					uni.showToast({
						title: '请输入内容',
						icon: 'none'
					})
					return
				}
				this.show = !this.show;
			},
			confirm(){
				const datas = {
					cname:this.cantrouy
				}
				api.sendtoData(datas).then((res)=>{
					uni.showToast({
						title:res.msg,
						icon: 'none'
					})
					this.cantrouy ='';
					uni.navigateTo({
						url:"/pages/manage/categroy"
					})
					return
				})
			}
		}
	}
</script>

<style>
	@import "./editor-icon.css";
	.listcontent{background: #27ae60; width: 100%; overflow-y:scroll; height: 100vh; ;}
	.contelis{ width: 900px; margin: 0 auto; background-color: #fff; height: 100vh; overflow-y: scroll;}
	.titles{  background-color: #ccc; height: 150px; line-height: 150px;text-align: center; font-size: 20px; position: relative;}
	.backs{ position: absolute; left: 50px; top: 20px; font-size: 18px; height: 30px; line-height: 30px;}
	.addblog{ background-color: #eee; width:100%; min-height: 200px;}
	.tables{ margin-top: 20px;}
	.addcate{ width:90%; margin-left: 5%; background-color: #F1F1F1;margin-top: 30px; border-radius: 10px; padding: 30px; background-color: #fff;display: flex;flex-direction: column;}
</style>
